import SwiftUI

struct SettingsView: View {
    @Binding var opacity: Double
    @Binding var showWeekNumbers: Bool
    @Binding var themeColor: Color
    
    var body: some View {
        VStack(spacing: 15) {
            Text("设置")
                .font(.headline)
                .padding(.bottom, 10)
            
            // 透明度设置
            HStack {
                Text("透明度:")
                Slider(value: $opacity, in: 0.5...1.0, step: 0.1)
                Text(String(format: "%.1f", opacity))
            }
            
            // 显示周数设置
            Toggle("显示周数", isOn: $showWeekNumbers)
            
            // 主题颜色选择
            HStack {
                Text("主题色:")
                ColorPicker("", selection: $themeColor)
                    .frame(width: 50, height: 30)
            }
            
            Spacer()
        }
        .padding()
        .frame(width: 300, height: 200)
    }
}

struct SettingsView_Previews: PreviewProvider {
    static var previews: some View {
        SettingsView(
            opacity: .constant(1.0),
            showWeekNumbers: .constant(false),
            themeColor: .constant(.blue)
        )
    }
}